home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 58519 / 58519.xpi / chrome / nasatabs.jar / content / tabs.xml < prev   
Extensible Markup Language  |  2010-01-15  |  9KB  |  224 lines

  1. <?xml version="1.0"?>
  2. <!DOCTYPE bindings [
  3. <!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
  4. %globalDTD;
  5. <!ENTITY % tabBrowserDTD SYSTEM "chrome://browser/locale/tabbrowser.dtd">
  6. %tabBrowserDTD;
  7. ]>
  8. <bindings id="nasatabs" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  9.   xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl">
  10.   <binding id="nasa-tab" display="xul:hbox" extends="chrome://global/content/bindings/tabbox.xml#tab">
  11.     <content chromedir="&locale.dir;" closetabtext="&closeTab.label;">
  12.       <xul:hbox class="tab-image-left tab-startcap tab-left tab-left-border" xbl:inherits="selected,hover"/>
  13.       <xul:hbox class="tab-drag-indicator-left"/>
  14.       <xul:toolbarbutton anonid="tmp-close-button" tabindex="-1" class="tab-close-button always-left"/>
  15.       <xul:hbox flex="1" class="tab-middle box-inherit tab-image-middle tab-body" align="center" xbl:inherits="selected">
  16.         <xul:stack class="tab-icon">
  17.           <xul:image class="tab-icon-image" xbl:inherits="validate,src=image"/>
  18.           <xul:image class="tab-protect-icon"/>
  19.           <xul:image class="tab-lock-icon"/>
  20.         </xul:stack>
  21.         <xul:stack class="tab-text-stack" flex="1">
  22.           <xul:progressmeter class="tab-progress" flex="2" mode="normal" value="0" xbl:inherits="value=tab-progress"/>
  23.           <xul:label class="tab-text" xbl:inherits="value=label,accesskey,crop,disabled" flex="1"/>
  24.           <xul:hbox class="showhover-box">
  25.             <xul:toolbarbutton anonid="tmp-close-button" tabindex="-1" class="showhover tabs-closebutton"/>
  26.           </xul:hbox>
  27.         </xul:stack>
  28.       </xul:hbox>
  29.       <xul:toolbarbutton anonid="tmp-close-button" tabindex="-1" class="tab-close-button always-right"/>
  30.       <xul:hbox class="tab-drag-indicator-right"/>
  31.       <xul:hbox class="tab-image-right tab-endcap tab-right tab-right-border" xbl:inherits="selected,hover"/>
  32.     </content>
  33.     <implementation>
  34.       <field name="mOverCloseButton">
  35.         false
  36.       </field>
  37.       <field name="mIsHover">
  38.         false
  39.       </field>
  40.       <field name="mButtonId">
  41.         0
  42.       </field>
  43.       <field name="mFocusId">
  44.         0
  45.       </field>
  46.       <field name="mSelect">
  47.         0
  48.       </field>
  49.       <property name="mouseHoverSelect" readonly="true">
  50.         <getter><![CDATA[
  51.           try {
  52.             return gTabmixPrefs.getBoolPref("extensions.tabmix.mouseOverSelect");
  53.           }
  54.           catch(e) {
  55.             return false;
  56.           }
  57.         ]]></getter>
  58.       </property>
  59.       <property name="mouseDownSelect" readonly="true">
  60.         <getter><![CDATA[
  61.           try {
  62.             return gTabmixPrefs.getBoolPref("extensions.tabmix.mouseDownSelect");
  63.           }
  64.           catch(e) {
  65.             return false;
  66.           }
  67.         ]]></getter>
  68.       </property>
  69.       <property name="mouseHoverSelectDelay" readonly="true">
  70.         <getter><![CDATA[
  71.           try {
  72.             return gTabmixPrefs.getIntPref("extensions.tabmix.mouseOverSelectDelay");
  73.           }
  74.           catch(e) {
  75.             return 250;
  76.           }
  77.         ]]></getter>
  78.       </property>
  79.       <property name="tabXDelay" readonly="true">
  80.         <getter><![CDATA[
  81.           try {
  82.             return gTabmixPrefs.getIntPref("extensions.tabmix.tabXDelay");
  83.           }
  84.           catch(e) {
  85.           return 0;
  86.           }
  87.         ]]></getter>
  88.       </property>
  89.       <property name="baseY" readonly="true" onget="return this.boxObject.y+this.boxObject.height;"/>
  90.       <method name="onMouseOver">
  91.         <parameter name="aEvent"/>
  92.         <body><![CDATA[
  93.           var anonid = aEvent.originalTarget.getAttribute("anonid");
  94.           if (anonid == "tmp-close-button")
  95.             this.mOverCloseButton = true;
  96.           this.mIsHover = true;
  97.           this.mButtonId = window.setTimeout(this.setShowButton, this.tabXDelay, this);
  98.           if (this.mouseHoverSelect)
  99.             this.mFocusId = window.setTimeout(this.doMouseHoverSelect, this.mouseHoverSelectDelay, this);
  100.         ]]></body>
  101.       </method>
  102.       <method name="doMouseHoverSelect">
  103.         <parameter name="aTab"/>
  104.         <body><![CDATA[
  105.           if (!aTab || !aTab.parentNode)
  106.             return;
  107.           var b = aTab.parentNode.parentNode.parentNode.parentNode;
  108.           if (b.hasAttribute("preventMouseHoverSelect"))
  109.               b.removeAttribute("preventMouseHoverSelect");
  110.           else if (aTab.mIsHover)
  111.              aTab.parentNode.selectedItem = aTab;
  112.         ]]></body>
  113.       </method>
  114.       <method name="setShowButton">
  115.         <parameter name="aTab"/>
  116.         <body><![CDATA[
  117.           if (!aTab || !aTab.parentNode)
  118.             return;
  119.           if ( aTab.mIsHover && aTab.getAttribute("showbutton") != "on")
  120.             aTab.setAttribute("showbutton", "on");
  121.         ]]></body>
  122.       </method>
  123.       <method name="onMouseOut">
  124.         <parameter name="aEvent"/>
  125.         <body><![CDATA[
  126.           var anonid = aEvent.originalTarget.getAttribute("anonid");
  127.           if (anonid == "tmp-close-button")
  128.             this.mOverCloseButton = false;
  129.           this.mIsHover = false;
  130.           clearTimeout(this.mButtonId);
  131.           this.mButtonId = window.setTimeout(this.removeShowButton, this.tabXDelay, this);
  132.           if (this.mouseHoverSelect && this.mFocusId)
  133.             clearTimeout(this.mFocusId);
  134.         ]]></body>
  135.       </method>
  136.       <method name="removeShowButton">
  137.         <parameter name="aTab"/>
  138.         <body><![CDATA[
  139.           if (!aTab || !aTab.parentNode)
  140.             return;
  141.           if (!aTab.mIsHover && aTab.getAttribute("showbutton") != "off")
  142.             aTab.setAttribute("showbutton", "off");
  143.         ]]></body>
  144.       </method>
  145.       <method name="onMouseCommand">
  146.         <parameter name="aEvent"/>
  147.         <body><![CDATA[
  148.           if ( this == this.parentNode.selectedItem ) {
  149.             this.setAttribute("clickOnCurrent","true");
  150.           }
  151.           else if (!aEvent.shiftKey && !aEvent.ctrlKey && !aEvent.altKey && !aEvent.metaKey) {
  152.             function TMclickSetTab(tab) {
  153.               if (tab.parentNode)
  154.                 tab.parentNode._selectNewTab(tab);
  155.             }
  156.             this.mSelect = setTimeout(TMclickSetTab, 0, this);
  157.           }
  158.         ]]></body>
  159.       </method>
  160.       <method name="clearTimeouts">
  161.         <body><![CDATA[
  162.           let timeouts = ["mSelect", "mFocusId", "mButtonId", "autoReloadTimerID"];
  163.           timeouts.forEach(function(aTimeout) {
  164.             if (aTimeout in this && this[aTimeout]) {
  165.               clearTimeout(this[aTimeout]);
  166.               this[aTimeout] = null;
  167.             }
  168.           });
  169.           this.removeEventListener("mousedown", this.TMP_mousedownEventHandler, true);
  170.         ]]></body>
  171.       </method>    
  172.       <field name="TMP_mousedownEventHandler" readonly="true">
  173.         <![CDATA[({
  174.           mTab: this,
  175.           handleEvent: function handleEvent(aEvent) {
  176.           if (aEvent.button != "0" || aEvent.target.localName != "tab")
  177.               return;
  178.            var anonid = aEvent.originalTarget.getAttribute("anonid");
  179.            if (this.mTab != this.mTab.parentNode.selectedItem && anonid != "tmp-close-button" &&
  180.              (aEvent.shiftKey || aEvent.ctrlKey || aEvent.altKey || aEvent.metaKey)) {
  181.              return;
  182.            }
  183.            if (this.mTab.mouseDownSelect && anonid != "tmp-close-button")
  184.              return;
  185.           }
  186.         })]]>
  187.       </field>
  188.       <constructor>
  189.         <![CDATA[
  190.           if (this._inited)
  191.             return;
  192.           this._inited = true;
  193.           this.addEventListener("mousedown", this.TMP_mousedownEventHandler, true);
  194.         ]]>
  195.       </constructor>
  196.       <destructor>
  197.         <![CDATA[
  198.           this.clearTimeouts();
  199.         ]]>
  200.       </destructor>
  201.     </implementation>
  202.     <handlers>
  203.       <handler event="mouseover">
  204.         <![CDATA[
  205.           this.onMouseOver(event);
  206.         ]]>
  207.       </handler>
  208.       <handler event="mouseout">
  209.         <![CDATA[
  210.           this.onMouseOut(event);
  211.         ]]>
  212.       </handler>
  213.       <handler event="click" button="0">
  214.         <![CDATA[
  215.           var anonid = event.originalTarget.getAttribute("anonid");
  216.           if (anonid != "tmp-close-button" && !this.mouseDownSelect) {
  217.             this.onMouseCommand(event);
  218.           }
  219.         ]]>
  220.       </handler>
  221.     </handlers>
  222.   </binding>
  223. </bindings>
  224.